package com.ax.base.drugstore.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ax.base.common.utils.PageUtils;
import com.ax.base.common.utils.Query;
import com.ax.base.drugstore.dao.BasePersonnelMapper;
import com.ax.base.drugstore.domain.BasePersonnel;
import com.ax.base.drugstore.service.DrugstoreManagerService;

@Service("DrugstoreManagerService")
public class DrugstoreManagerServiceImpl implements DrugstoreManagerService {

	@Autowired
	BasePersonnelMapper basePersonnelMapper;
	
	/**
	 * 药房人员查询(模块:药店人员)
	 * 
	 * @param Map<String, Object> map
	 *           
	 * @return PageUtils
	 */
	@Override
	public PageUtils queryDrugStoreManagerSer(Map<String, Object> params) {
		Query query = new Query(params);
		List<BasePersonnel> basePersonnels = basePersonnelMapper.queryDrugStoreManagerMapper(query);
		int total = basePersonnelMapper.count(query);
		PageUtils pageUtil = new PageUtils(basePersonnels,total);
		return pageUtil;
	}

	/**
	 * 药房人员保存(模块:药店人员)
	 * 
	 * @param BasePersonnel basePersonnel
	 *           
	 * @return SUCC
	 */
	@Override
	public void insertBasePersonnelSer(BasePersonnel basePersonnel) {
		basePersonnelMapper.insertSelective(basePersonnel);
	}

	/**
	 * 药方人员修改(模块:药店人员)*跳转修改页面
	 * 
	 * @param Long id
	 *           
	 * @return HTML
	 */
	@Override
	public BasePersonnel getBasePersonnelSer(Long id) {
		return basePersonnelMapper.selectByPrimaryKey(id);
	}

	/**
	 * 药方人员修改(模块:药店人员)
	 * 
	 * @param BasePersonnel basePersonnel
	 *           
	 * @return SUCC
	 */
	@Override
	public void updateBasePersonnelSer(BasePersonnel basePersonnel){
		basePersonnelMapper.updateByPrimaryKeySelective(basePersonnel);
	}

}
